#include<stdio.h>
#define COWLS 5
#define LINES 5
int main()
{
	double arr[COWLS][LINES];
	int i,j;
	for(i=0;i<COWLS;i++)
	{
		for(j=0;j<LINES;j++)
		{
			scanf("%lf",&arr[i][j]);
		}
	}
	double sum1=0;
	double sum2=0;
	for(i=0;i<5;i++)
	{
		sum1+=arr[i][i];
	}
	int h=4;
	for(i=0;i<5;i++)
	{
		sum2+=arr[i][h];
		h--;
	}
	printf("%lf   %lf ",sum1,sum2);
}